package io.github.talelin.latticy.controller.api;

import io.github.talelin.latticy.dto.message.MessageDTO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lms
 * @date 2021/5/4 11:15
 * @description
 */
@RequestMapping("/api/websocket")
@RestController
public class websocketApiController {

    @Autowired
    private MessageDTO message;

    @GetMapping("/send")
    public MessageDTO send(MessageDTO dto) {
        System.out.println("你发的" + dto);
        System.out.println(message);
        BeanUtils.copyProperties(dto, message);
        return dto;
    }

    @RequestMapping("/get")
    public MessageDTO get() {
        return message;
    }

}
